<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
	</head>
	<body>
		<div id="app">
			{{num}}
			<br />
			<input type="text" v-model="num">

		</div>

		<script>
			var app = Vue.createApp({
				data() {
					return {
						"message": "hello vue!",
						"num": 10,
					}
				},

				methods: {
					sleep(numberMillis) {
						var now = new data();
						var exitTime = now.getTime() + numberMillis;
						while (true) {
							now = new Date();
							if (now.getTime() > exitTime) {
								return;
							}
						}
					}
				}

               methods:{
				   
			   }

         



				watch: {
					num(newVal, oldVal) {
						console.log("旧的值" + oldVal)
						console.log("新的值" + newVal)
						this.nessage = "监听num数据改变了，旧的值" + oldVal "新的值" + newVal
						this, sleep(2000)
						this.result = Math.sqrt(parseInt(this.newVal))
						console.log(this.result)
						var worker = new worker("longtask.js")
						worker.onmessage = (event)=>this.result=event
						worker.postMessage(newVal)
					}


				}
			});




			var vm = app.mount("#app")
		</script>
	</body>
</html>
